<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>系统首页</title>
    <link rel="stylesheet" href="{$CSS}/bootstrap3.3.7.min.css">
    <style>
        em{
            font-size: 20px;
            color: red;
            vertical-align: middle;
            line-height: 20px;
            height: 20px;
            display: inline-block;
        }
        .mar{
            margin-right:10px
        }
        .pic{
        	float:none;margin-bottom:10px
        }
        .pic img{
        	width: 393px;
    		height: 75px;
    	}
    </style>
</head>
<body style="overflow-x:hidden;">
    <div style="padding:10px;border-bottom:1px solid #eee;font-size:15px;font-weight:700">{if $articleManage->id}修改文章{else}新增文章{/if}</div>
    <div style="margin:40px auto;">
        <div class="bs-example" data-example-id="simple-horizontal-form">
            <form class="form-horizontal" method="post" action=""  id="regform">{tk()}{$articleManage->hidden('id')}
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">标题</label>
                    <div class="col-sm-3">
						{$articleManage->text('title','class="form-control" placeholder="标题"')}
						<span class="help-inline"></span>
                    </div>
                </div>
				<div class="form-group">
                  <label class="col-sm-2 control-label">封面</label>
                     <div class="col-sm-8">
                       <img class="thumb_img" src="{$articleManage->pic}" id="pic_pic" relobj="elfinder_pic" style=" width: 300px; height: 75px;" />
                       {$articleManage->hidden('pic')}
                        <button class="btn btn-default select_img" type="button" data-target="pic">选择图片</button>
                        <span class="help-inline"></span>
                      </div>
                </div>
				<div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">内容</label>
                    <div class="col-sm-3">
						 <textarea id="contents"  name="contents" style="border:1px solid #E5E5E5;width:700px;height:30vw" rows="20" cols="50">{$articleManage->contents}</textarea>   
						 <span class="help-inline"></span>
                    </div>
                </div>
				<div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">排序</label>
                    <div class="col-sm-3">
						   {$articleManage->text('sort','class="form-control" placeholder="排序"')}
                    </div>
                </div>
                <div class="form-group">
                   <label for="inputPassword3" class="col-sm-2 control-label"></label>
                    <div class="col-sm-6">
						<input class="btn btn-success mar" type="hidden" name="action" value="add" />
                        <input class="btn btn-success mar" name="btnAdd" ID="btnAdd" onclick="registerUser()" type="button" class="button" value="提交">
                        <input class="btn btn-warning mar" name="reset" ID="Submit1" type="reset" value="重置">
                        <input class="btn btn-danger mar"  name="back" ID="back" type="button" onclick="history.back();" value="返回">
                        </div>
                </div>
				
            </form>
        </div>

    </div>
</body>

</html>
	<script src="/ueditor/ueditor.config.js">/*引入配置文件*/</script>
	<script src="/ueditor/ueditor.all.js">/*引入源码文件*/</script>
	<script type="text/javascript">
	//实例化编辑器  传参,id为将要被替换的容器。
		UE.getEditor('contents', {
		toolbars: [
         [
        'source', //源代码
        'undo', //撤销
        'redo', //重做
        'bold', //加粗
        'indent', //首行缩进        
        'italic', //斜体
        'underline', //下划线
        'strikethrough', //删除线
        'subscript', //下标
        'fontborder', //字符边框
        'superscript', //上标
        'formatmatch', //格式刷
        'pasteplain', //纯文本粘贴模式
        'selectall', //全选
        'horizontal', //分隔线
        'removeformat', //清除格式
        'time', //时间
        'date', //日期
        // 'insertrow', //前插入行
        // 'insertcol', //前插入列
        // 'mergeright', //右合并单元格
        // 'mergedown', //下合并单元格
        // 'deleterow', //删除行
        // 'deletecol', //删除列
        // 'splittorows', //拆分成行
        // 'splittocols', //拆分成列
        // 'splittocells', //完全拆分单元格
        // 'deletecaption', //删除表格标题
        // 'inserttitle', //插入标题
        // 'mergecells', //合并多个单元格
        // 'deletetable', //删除表格
        'cleardoc', //清空文档
        // 'insertparagraphbeforetable', //"表格前插入行"
        'fontfamily', //字体
        'fontsize', //字号
        'paragraph', //段落格式
        'simpleupload', //单图上传
        // 'edittable', //表格属性
        // 'edittd', //单元格属性
        'emotion', //表情
        'spechars', //特殊字符
        'searchreplace', //查询替换
        'justifyleft', //居左对齐
        'justifyright', //居右对齐
        'justifycenter', //居中对齐
        'justifyjustify', //两端对齐
        'forecolor', //字体颜色
        'backcolor', //背景色
        'insertorderedlist', //有序列表
        'insertunorderedlist', //无序列表
        'fullscreen', //全屏
        'directionalityltr', //从左向右输入
        'directionalityrtl', //从右向左输入
        'rowspacingtop', //段前距
        'rowspacingbottom', //段后距
        // 'pagebreak', //分页
        'imagenone', //默认
        'imageleft', //左浮动
        'imageright', //右浮动
        'attachment', //附件
        'imagecenter', //居中
        'wordimage', //图片转存
        'lineheight', //行间距
        'edittip ', //编辑提示
        'customstyle', //自定义标题
        'autotypeset', //自动排版
        'touppercase', //字母大写
        'tolowercase', //字母小写
        // 'background', //背景
        'template', //模板
        // 'scrawl', //涂鸦
        // 'inserttable', //插入表格
    ]
		],
		autoHeightEnabled: true,
		autoFloatEnabled: true
		});
    </script>
<script type="text/javascript">
	
	function registerUser(){  
		$('.help-inline').remove();
		$('font').css('display','none')
		$('#regform').validate(function(m){
		    if(m.length>0){
		        for(var i=0;i<m.length;i++){
		            //m[i].e为验证错误的表单元素
		            //m[i].m该单元的错误信息（非空错误为false，其他为信息数组）
		 			var ntip = $('<span class="help-inline" style="color:red">'+(m[i].m===false?'该项内容不能为空':m[i].m.join(','))+'</span>');
		            $(m[i].e).after(ntip.show());
		            $(m[i].e).one('blur',function(){
		            	ntip.remove();
		            });
		        }
		    }else{
		        $('form').submit();
		    }
		});
	}
</script>
<script src="/layui/layui.js"></script>
<script>
layui.use(['element', 'layer', 'upload'], function () {
  var layer = layui.layer;
});
$('.select_img').on('click',function  () {
  var targetId=this.getAttribute('data-target');
  layer.open({
    title:'图片库',
    type: 2,
    area: ['700px', '450px'],
    fixed: false, //不固定
    maxmin: false,
    content: '/imgLib/libs.html?type=vshop_img&target='+targetId
  });
})

window.uploadImgCallback=function (tgt,url) {
  console.log('选择图片结果',tgt,url);
   if(tgt=='pic'){
	var inputEle=$('#pay_article_managepic');
    var prevEle=$('#pic_pic');
    inputEle.val(url);
    prevEle.attr('src',url);
  }
};

</script>  